/** 
* @file         input.h
* @brief        This is a brief description. 
* @details  This is the detail description. 
* @author     Administrator
* @date     Jun 10, 2014
* @version  A001 
* @par Copyright (c):  
*       
* @par History:          
*   version: Administrator, Jun 10, 2014\n 
*/
#ifndef INPUT_H_
#define INPUT_H_

#include "../hal_include/hal_types.h"

typedef union {
    struct {
        uint8 in0:1;
        uint8 in1:1;
        uint8 in2:1;
        uint8 in3:1;
        uint8 in4:1;
        uint8 in5:1;
        uint8 in6:1;
        uint8 in7:1;
        uint8 in10:1;
        uint8 in11:1;
        uint8 in12:1;
        uint8 in13:1;
        uint8 in14:1;
        uint8 in15:1;
        uint8 in16:1;
        uint8 in17:1;
        uint8 in20:1;
        uint8 in21:1;
        uint8 in22:1;
        uint8 in23:1;
        uint8 in24:1;
        uint8 in25:1;
        uint8 in26:1;
        uint8 in27:1;
        uint8 in28:1;
        uint8 in29:1;
        uint8 in30:1;
        uint8 in31:1;
    }bit;
    uint32 in;
} input_addr;

typedef struct {
    input_addr input_cur; /*!< 当前输入口状态 */
    input_addr input_adjust; /*!< 当前输入口状态 */
    input_addr input_old; /*!< 记录之前的输入口状态 */
}input_status_process;

#define INPUT_CUR status_process.input_cur.in
#if INPUT_MAX_NUM > 0
#define IN0 status_process.input_cur.bit.in0
#endif
#if INPUT_MAX_NUM > 1
#define IN1 status_process.input_cur.bit.in1
#endif
#if INPUT_MAX_NUM > 2
#define IN2 status_process.input_cur.bit.in2
#endif
#if INPUT_MAX_NUM > 3
#define IN3 status_process.input_cur.bit.in3
#endif
#if INPUT_MAX_NUM > 4
#define IN4 status_process.input_cur.bit.in4
#endif
#if INPUT_MAX_NUM > 5
#define IN5 status_process.input_cur.bit.in5
#endif
#if INPUT_MAX_NUM > 6
#define IN6 status_process.input_cur.bit.in6
#endif
#if INPUT_MAX_NUM > 7
#define IN7 status_process.input_cur.bit.in7
#endif
#if INPUT_MAX_NUM > 8
#define IN10 status_process.input_cur.bit.in10
#endif
#if INPUT_MAX_NUM > 9
#define IN11 status_process.input_cur.bit.in11
#endif
#if INPUT_MAX_NUM > 10
#define IN12 status_process.input_cur.bit.in12
#endif
#if INPUT_MAX_NUM > 11
#define IN13 status_process.input_cur.bit.in13
#endif
#if INPUT_MAX_NUM > 12
#define IN14 status_process.input_cur.bit.in14
#endif
#if INPUT_MAX_NUM > 13
#define IN15 status_process.input_cur.bit.in15
#endif
#if INPUT_MAX_NUM > 14
#define IN16 status_process.input_cur.bit.in16
#endif
#if INPUT_MAX_NUM > 15
#define IN17 status_process.input_cur.bit.in17
#endif
#if INPUT_MAX_NUM > 16
#define IN20 status_process.input_cur.bit.in20
#endif
#if INPUT_MAX_NUM > 17
#define IN21 status_process.input_cur.bit.in21
#endif
#if INPUT_MAX_NUM > 18
#define IN22 status_process.input_cur.bit.in22
#endif
#if INPUT_MAX_NUM > 19
#define IN23 status_process.input_cur.bit.in23
#endif
#if INPUT_MAX_NUM > 20
#define IN24 status_process.input_cur.bit.in24
#endif
#if INPUT_MAX_NUM > 21
#define IN25 status_process.input_cur.bit.in25
#endif

#define INPUT_OLD status_process.input_old.in
#if INPUT_MAX_NUM > 0
#define IN0_OLD status_process.input_old.bit.in0
#endif
#if INPUT_MAX_NUM > 1
#define IN1_OLD  status_process.input_old.bit.in1
#endif
#if INPUT_MAX_NUM > 2
#define IN2_OLD  status_process.input_old.bit.in2
#endif
#if INPUT_MAX_NUM > 3
#define IN3_OLD  status_process.input_old.bit.in3
#endif
#if INPUT_MAX_NUM > 4
#define IN4_OLD  status_process.input_old.bit.in4
#endif
#if INPUT_MAX_NUM > 5
#define IN5_OLD  status_process.input_old.bit.in5
#endif
#if INPUT_MAX_NUM > 6
#define IN6_OLD  status_process.input_old.bit.in6
#endif
#if INPUT_MAX_NUM > 7
#define IN7_OLD  status_process.input_old.bit.in7
#endif
#if INPUT_MAX_NUM > 8
#define IN10_OLD  status_process.input_old.bit.in10
#endif
#if INPUT_MAX_NUM > 9
#define IN11_OLD  status_process.input_old.bit.in11
#endif
#if INPUT_MAX_NUM > 10
#define IN12_OLD  status_process.input_old.bit.in12
#endif
#if INPUT_MAX_NUM > 11
#define IN13_OLD  status_process.input_old.bit.in13
#endif
#if INPUT_MAX_NUM > 12
#define IN14_OLD  status_process.input_old.bit.in14
#endif
#if INPUT_MAX_NUM > 13
#define IN15_OLD  status_process.input_old.bit.in15
#endif
#if INPUT_MAX_NUM > 14
#define IN16_OLD  status_process.input_old.bit.in16
#endif
#if INPUT_MAX_NUM > 15
#define IN17_OLD  status_process.input_old.bit.in17
#endif
#if INPUT_MAX_NUM > 16
#define IN20_OLD  status_process.input_old.bit.in20
#endif
#if INPUT_MAX_NUM > 17
#define IN21_OLD  status_process.input_old.bit.in21
#endif
#if INPUT_MAX_NUM > 18
#define IN22_OLD  status_process.input_old.bit.in22
#endif
#if INPUT_MAX_NUM > 19
#define IN23_OLD  status_process.input_old.bit.in23
#endif
#if INPUT_MAX_NUM > 20
#define IN24_OLD  status_process.input_old.bit.in24
#endif
#if INPUT_MAX_NUM > 21
#define IN25_OLD  status_process.input_old.bit.in25
#endif


#define INPUT_ADJUST status_process.input_adjust.in
#if INPUT_MAX_NUM > 0
#define IN0_adjust status_process.input_adjust.bit.in0
#endif
#if INPUT_MAX_NUM > 1
#define IN1_adjust status_process.input_adjust.bit.in1
#endif
#if INPUT_MAX_NUM > 2
#define IN2_adjust status_process.input_adjust.bit.in2
#endif
#if INPUT_MAX_NUM > 3
#define IN3_adjust status_process.input_adjust.bit.in3
#endif
#if INPUT_MAX_NUM > 4
#define IN4_adjust status_process.input_adjust.bit.in4
#endif
#if INPUT_MAX_NUM > 5
#define IN5_adjust status_process.input_adjust.bit.in5
#endif
#if INPUT_MAX_NUM > 6
#define IN6_adjust status_process.input_adjust.bit.in6
#endif
#if INPUT_MAX_NUM > 7
#define IN7_adjust status_process.input_adjust.bit.in7
#endif
#if INPUT_MAX_NUM > 8
#define IN10_adjust status_process.input_adjust.bit.in10
#endif
#if INPUT_MAX_NUM > 9
#define IN11_adjust status_process.input_adjust.bit.in11
#endif
#if INPUT_MAX_NUM > 10
#define IN12_adjust status_process.input_adjust.bit.in12
#endif
#if INPUT_MAX_NUM > 11
#define IN13_adjust status_process.input_adjust.bit.in13
#endif
#if INPUT_MAX_NUM > 12
#define IN14_adjust status_process.input_adjust.bit.in14
#endif
#if INPUT_MAX_NUM > 13
#define IN15_adjust status_process.input_adjust.bit.in15
#endif
#if INPUT_MAX_NUM > 14
#define IN16_adjust status_process.input_adjust.bit.in16
#endif
#if INPUT_MAX_NUM > 15
#define IN17_adjust status_process.input_adjust.bit.in17
#endif
#if INPUT_MAX_NUM > 16
#define IN20_adjust status_process.input_adjust.bit.in20
#endif
#if INPUT_MAX_NUM > 17
#define IN21_adjust status_process.input_adjust.bit.in21
#endif
#if INPUT_MAX_NUM > 18
#define IN22_adjust status_process.input_adjust.bit.in22
#endif
#if INPUT_MAX_NUM > 19
#define IN23_adjust status_process.input_adjust.bit.in23
#endif
#if INPUT_MAX_NUM > 20
#define IN24_adjust status_process.input_adjust.bit.in24
#endif
#if INPUT_MAX_NUM > 21
#define IN25_adjust status_process.input_adjust.bit.in25
#endif
extern void input_init(void);
extern void input_status_mechine(void);

#endif /* INPUT_H_ */
